package com.sqn.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * description: 路由跳转页面
 *
 * @author sqn
 * @version 1.0
 * @date 2021/5/29 0029 上午 11:14
 */
@Controller
public class RouterController {

    /**
     * description: 跳转到index页面
     *
     * @return: java.lang.String
     * @author sqn
     * @date: 2021/5/29 0029 上午 11:17
     */
    @RequestMapping({"/", "/index"})
    public String index() {
        return "index";
    }

    /**
     * description: 跳转到login页面
     *
     * @return: java.lang.String
     * @author sqn
     * @date: 2021/5/29 0029 上午 11:17
     */
    @RequestMapping("/toLogin")
    public String toLogin() {
        return "views/login";
    }

    /**
     * description: 跳转到level1页面
     *
     * @param id id
     * @return: java.lang.String
     * @author sqn
     * @date: 2021/5/29 0029 上午 11:22
     */
    @RequestMapping("/level1/{id}")
    public String level1(@PathVariable("id") int id) {
        return "views/level1/" + id;
    }

    /**
     * description: 跳转到level2页面
     *
     * @param id id
     * @return: java.lang.String
     * @author sqn
     * @date: 2021/5/29 0029 上午 11:22
     */
    @RequestMapping("/level2/{id}")
    public String level2(@PathVariable("id") int id) {
        return "views/level2/" + id;
    }

    /**
     * description: 跳转到level3页面
     *
     * @param id id
     * @return: java.lang.String
     * @author sqn
     * @date: 2021/5/29 0029 上午 11:22
     */
    @RequestMapping("/level3/{id}")
    public String level3(@PathVariable("id") int id) {
        return "views/level3/" + id;
    }

}
